In a network evaluation and optimization phase, an operator needs to evaluate and optimize the network and analyze a network element in the network and a service state, for example, collecting configuration information of the network element, collecting traffic information of a port, evaluating capacity of the port, discovering a traffic-overloaded port, and extending capacity or adjusting a traffic path of the traffic-overloaded port. When the network is evaluated and optimized by using an optimization and analysis tool, a network topology needs to be restored by depending on the optimization and analysis tool, so that a network traffic evaluation, a service evaluation and a simulation can be implemented based on the network topology, and a result of evaluating and analyzing the network can be displayed based on the network topology.
In a method for discovering a network topology in the prior art, network characteristic data of a network element in a to-be-analyzed network is collected, and a link set corresponding to a network topology discovery algorithm is obtained by calculation according to the collected network characteristic data and the corresponding network topology discovery algorithm to obtain the network topology. For example, the network characteristic data includes a port Internet Protocol (Internet Protocol, IP) address, a port alias, and the like, and a network topology based on a characteristic of the port IP address can be obtained by calculation according to the port IP address and a port IP address topology discovery algorithm, or a network topology based on a characteristic of the port alias can be obtained by calculation according to the port alias and a port alias topology matching algorithm; or a network topology based on Cisco device networking (a protocol supports a Cisco device only) can be obtained by calculation according to the Cisco Discovery Protocol (Cisco Discovery Protocol, CDP), or the like.
In the prior art, if a network topology is discovered based on a single type of network characteristic data for a to-be-analyzed network, the network topology may be discovered at a low accuracy because devices from different manufactures in the to-be-analyzed network may not support a discovery of the network topology using the network characteristic data; in addition, when the network topology is discovered based on multiple types of network characteristic data, a large quantity of the multiple types of network characteristic data needs to be collected, consuming more network resources.